#!/bin/bash

INITFILE=$1

systemctl stop slapd
rm -rf /etc/ldap/slapd.d/*
mv /etc/ldap/slapd.d /etc/ldap/slapd.d`date +%Y%m%d-%H%M%S`
mkdir /etc/ldap/slapd.d
slapadd -n 0 -F /etc/ldap/slapd.d -l $INITFILE
chown -R openldap:openldap /etc/ldap/slapd.d
systemctl start slapd